Heatmap
# heatmap function
makeHM <- function(se, sig, nr=20, logcpm=FALSE){
for(i in sig){
if(sum(rowData(se)$DEA.all$FDR < i) > nr){
cat("FDR <", i, "\n")
# logFC heatmap
SEtools::sehm(se[,order(colData(se)$miRNA)], row.names(se)[rowData(se)$DEA.all$FDR < i], gaps_at = "readtype",
breaks=TRUE, do.scale = FALSE, show_colnames = FALSE, assayName = "log2FC", anno_columns = "miRNA")
# logcpm heatmap
if(logcpm){
SEtools::sehm(se[,order(colData(se)$miRNA)], row.names(se)[rowData(se)$DEA.all$FDR < i], gaps_at = "readtype",
breaks=TRUE, do.scale = TRUE, show_colnames = FALSE, assayName = "logcpm", anno_columns = "miRNA")
}
break
}
}
}
## FDR < 1e-05


Stats
## DEA.all DEA.DKOvWT
## 6473 6473
up-/downregulations at different significance levels
# check number of positive & negative logFC for different significances
sigsDF <- function(se, sig, dea, thr){
data.frame(sigLevel=rep(sig,3),
counts=c(sapply(sig, function(x) sum(sign(assays(se[rowData(se)[[dea]]$FDR < x,])$log2FC) == -1 &
abs(assays(se[rowData(se)[[dea]]$FDR < x,])$log2FC) >= thr)),
sapply(sig, function(x) sum(sign(assays(se[rowData(se)[[dea]]$FDR < x,])$log2FC) == 0 &
abs(assays(se[rowData(se)[[dea]]$FDR < x,])$log2FC) >= thr)),
sapply(sig, function(x) sum(sign(assays(se[rowData(se)[[dea]]$FDR < x,])$log2FC) == 1 &
abs(assays(se[rowData(se)[[dea]]$FDR < x,])$log2FC) >= thr))
),
sign=c(rep("-1",length(sig)),
rep("0",length(sig)),
rep("1",length(sig))
),
dea=rep(dea,length(sig)*3)
)
}
# for each model & DEA: find number of down- & upregulations at different significance levels
## significance levels of interest
sig <- c(1e-10, 1e-5, .05, .1, .5, .8)
## only absolute log2FC greater than this will be considered
fc.thr <- .5
## create dataframes with count informations
### [model = ~miRNA, model0 = ~1]
sigs <- lapply(grep("DEA",colnames(rowData(se)),value=TRUE), function(x){
sigsDF(se, sig, x, fc.thr)
})
sigs <- data.frame(do.call("rbind",sigs))
